package hibernate.dao;

// Generated Aug 19, 2012 8:26:34 PM by Hibernate Tools 3.4.0.CR1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Song generated by hbm2java
 */
@Entity
@Table(name = "song", catalog = "musicstore")
public class Song implements java.io.Serializable {

	private Integer idsong;
	private Artist artist;
	private String title;
	private String info;
	private Set<CdSong> cdSongs = new HashSet<CdSong>(0);

	public Song() {
	}

	public Song(Artist artist, String title) {
		this.artist = artist;
		this.title = title;
	}

	public Song(Artist artist, String title, String info, Set<CdSong> cdSongs) {
		this.artist = artist;
		this.title = title;
		this.info = info;
		this.cdSongs = cdSongs;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idsong", unique = true, nullable = false)
	public Integer getIdsong() {
		return this.idsong;
	}

	public void setIdsong(Integer idsong) {
		this.idsong = idsong;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idartist", nullable = false)
	public Artist getArtist() {
		return this.artist;
	}

	public void setArtist(Artist artist) {
		this.artist = artist;
	}

	@Column(name = "title", nullable = false, length = 45)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "info", length = 45)
	public String getInfo() {
		return this.info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "song")
	public Set<CdSong> getCdSongs() {
		return this.cdSongs;
	}

	public void setCdSongs(Set<CdSong> cdSongs) {
		this.cdSongs = cdSongs;
	}

}
